//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.utils.basehelper.collection;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

public class MapGcUtils {
    public MapGcUtils() {
    }

    public static void helpGC(Map... maps) {
        Map[] var1 = maps;
        int var2 = maps.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            Map map = var1[var3];
            if (Objects.nonNull(map)) {
                try {
                    map.clear();
                    map = null;
                } catch (Exception var6) {
                }
            }
        }

    }

    public static <K, V> void initialize(Map<K, List<V>> map, K k, V v) {
        if (Objects.isNull(map)) {
            map = new HashMap(16);
        }

        List<V> collection = (List)((Map)map).get(k);
        if (Objects.isNull(collection)) {
            collection = new ArrayList();
        }

        ((List)collection).add(v);
        ((Map)map).put(k, collection);
    }

    public static <K, V> void initialize(Map<K, List<V>> map, K k) {
        if (Objects.isNull(map)) {
            map = new HashMap(16);
        }

        List<V> collection = (List)((Map)map).get(k);
        if (Objects.isNull(collection)) {
            collection = new ArrayList();
        }

        ((Map)map).put(k, collection);
    }

    public static <K, V> void initializeSet(Map<K, Set<V>> map, K k) {
        if (Objects.isNull(map)) {
            map = new HashMap(16);
        }

        Set<V> collection = (Set)((Map)map).get(k);
        if (Objects.isNull(collection)) {
            collection = new HashSet();
        }

        ((Map)map).put(k, collection);
    }
}
